<?php
declare(strict_types=1);

namespace app\model\api\admin\system;

use app\model\api\admin\BaseAdmin;
use think\model\concern\SoftDelete;
use app\model\api\admin\system\Dept;

class User extends BaseAdmin
{
    use SoftDelete;
    protected $table = 'admin';

    protected $globalScope = ['DataScope'];
    public bool $dataScopeOn = true; // 子类可以覆盖这个属性来控制是否启用数据权限

    public function dept()
    {
        return $this->hasOne(Dept::class, 'id', 'dept_id');
    }
    public function roles()
    {
        return $this->belongsToMany(Role::class, 'admin_auth_group_access', 'group_id', 'uid');
    }
}
